﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPI.Entities.Lookup;

namespace PPI.Entities.Inspections
{
    public class EMap : ELookupBase
    {
        private List<ESection> m_Sections;

        public EMap()
            :base()
        {
            m_Sections = new List<ESection>();
        }

        public EMap(Int32 id)
        :this()
        {
            Id = id;
        }

        public EMap(Int32 id, string name)
            :this(id)
        {
            Name = name;
        }

        public void AddSection(ESection section)
        {
            if(!m_Sections.Contains(section))
            {
                m_Sections.Add(section);
            }
        }

        public void RemoveSection(ESection section)
        {
            if (m_Sections.Contains(section))
            {
                m_Sections.Remove(section);
            }
        }

        public List<ESection> Sections
        {
            get { return m_Sections; }
        }

        public override string ToString()
        {
            if (String.IsNullOrEmpty(Name))
                return Id.ToString();

            return Name;
        }
    }
}
